﻿using System.Collections.Generic;
using Baik.Interface.Execution;
using Baik.Interface.Framework;

namespace Baik.Execution
{
    public class Undefined : BuiltInObject, IUndefined
    {
        public Undefined(IInjector inject) : base(inject)
        {
            Dictionary.Add("isUndefined", inject.Instantiate<ITrue>());
            this.Assign("toString",  BuiltInFactory.Function(inject, ToIString));
        }

        private IObject ToIString(IEnumerable<IObject> arg)
        {
            var rtn = Inject.Instantiate<IString>();
            rtn.Value = "undefined";
            return rtn;
        }
    }
}